CREATE TABLE [dbo].[tb_RegimenPromocion]
(
[idRegimen] [int] NOT NULL IDENTITY(1, 1),
[Descripcion] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Cantidad] [int] NOT NULL
) ON [PRIMARY]
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE TRIGGER [dbo].[updatetb_RegimenPromocion] ON [dbo].[tb_RegimenPromocion]
 FOR UPDATE AS 
SET NOCOUNT ON
 IF (update(idRegimen)) begin 
	 SELECT * FROM inserted 
	 IF @@ROWCOUNT = 1 begin 
		 UPDATE tb_Carreras
		 SET RegimenPromocion = (SELECT idRegimen FROM inserted)
		 WHERE tb_Carreras.RegimenPromocion = (SELECT idRegimen FROM deleted)
	end  ELSE begin 
		 ROLLBACK TRANSACTION 
 end 
 end

GO
ALTER TABLE [dbo].[tb_RegimenPromocion] ADD CONSTRAINT [PK_tb_RegimenPromocion] PRIMARY KEY NONCLUSTERED  ([idRegimen]) ON [PRIMARY]
GO
